﻿using System;
using System.Collections.Generic;
using System.Web;

namespace RaceList.activity.util
{
    /// <summary>
    ///     存储于Session中，用户游戏时的数据
    /// </summary>
    public class UserChengji : IDisposable
    {
        public UserChengji()
        {
            IsClicked = false;
            IsHelp = false;
            ExpireTime = DateTime.MaxValue;
            Scores = new List<double>();
            ClientScores = new List<double>();
        }

        public DateTime ExpireTime { get; set; }

        /// <summary>
        ///     成绩
        /// </summary>
        public double Score { get; set; }

        public int ClickNum { get; set; }

        /// <summary>
        ///     默认值为false，点击以后为true
        /// </summary>
        public bool IsClicked { get; set; }

        /// <summary>
        ///     是否添加到数据库
        /// </summary>
        public bool IsAddedToDb { get; set; }

        /// <summary>
        ///     是否是帮帮跑,
        ///     默认为false，添加到Activity_Relay
        ///     为true表示帮帮跑，添加到Activity_SubRelay
        /// </summary>
        public bool IsHelp { get; set; }

        /// <summary>
        ///     非必要值
        ///     只是在帮帮跑的时候才有的主表的id值
        /// </summary>
        public int RelayId { get; set; }

        /// <summary>
        /// 在game.aspx中添加的空的Relay的主键id
        /// </summary>
        public int FirstAddRelayId { get; set; }
        /// <summary>
        /// game.aspx中初始化的成绩集合
        /// </summary>
        public List<double> Scores { get; set; }
        /// <summary>
        /// 从客户端中传递过来的成绩集合
        /// </summary>
        public List<double> ClientScores { get; set; }

        /// <summary>
        /// 客户端随机连续的(任意次数)成绩的连接
        /// </summary>
        public string ScoresFragment { get; set; }

        public void Dispose()
        {
            HttpContext.Current.Session[Keys.UserChengjistr] = null;
        }
    }
}